import 'package:flutter/material.dart';
import 'package:flutter_shop/pages/index_page.dart';
import 'package:flutter_shop/provide/cart_provide.dart';
import 'package:flutter_shop/provide/goods_detail_provide.dart';
import 'package:provide/provide.dart';
import 'package:flutter_shop/provide/goods_list.dart';
import 'package:fluro/fluro.dart';
import './routes/application.dart';
import './routes/index.dart';
void main(List<String> args) {
  var cartSubNavList = CartSubNavList();
  var goodsProvider = GoodsProvider();
  var goodsDetailProvider = GoodsDetailProvider();

  var providers = Providers();
  providers
    ..provide(Provider<CartSubNavList>.value(cartSubNavList))
    ..provide(Provider<GoodsDetailProvider>.value(goodsDetailProvider))
    ..provide(Provider<GoodsProvider>.value(goodsProvider));

  final FluroRouter router = FluroRouter();
  Routes.configureRoutes(router);
  Application.router = router;

  runApp(
    ProviderNode(child: MyApp(), providers: providers)
  );
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '百姓生活+',
      onGenerateRoute: Application.router.generator,
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primaryColor: Colors.pink
      ),

      home: IndexPage(),
    );
  }
}